package ca.cbc.msb.mobilemedia;

import java.util.Hashtable;

	@SuppressWarnings({ "rawtypes", "unchecked" })
	public enum YospaceStatus {
		OK(200),
		GENERAL_ERROR(599),
		AUTHENTICATION_FAIL(601),
		BAD_CONTENT_GROUP_ID(602),
		USER_DOES_NOT_OWN_RESOURCE(604),
		
		//item status, for checking item status 
		PROCESSING_FAILED(0), //invalid (The processing failed) 
		READY_FOR_USE(1), //valid (Ready for Use) 
		PROCESSING_IN_PROGRESS(2),// unknown (Processing is currently in progress) 
		
		/*
		//update specific
		NO_SUCH_MRSS_MEDIA_ITEM(606),  
		FIELD_SETTING_ERRORS(609),  
		NO_SUCH_FIELD_DEFINITION(605), 
		EXCEPTION_SETTING_FIELD(607), 
		FIELD_VALUE_SET_OK(608), 
		
		//CODE FOR replacing 
		FAIL(500),*/  
		
		UNKNOWN_STATUS;
	
		private int status;
		
		YospaceStatus(int status){
			this.status=status;
		}
		
		YospaceStatus(){}
		
		  public int value() {
		    return status;
		  }

		private static Hashtable _map;
		  static {
			_map = new Hashtable();
		    for (YospaceStatus statuses: YospaceStatus.values()) {
		    	_map.put(new Integer(statuses.value()), statuses);
		    }
		  }
		  
		  public static YospaceStatus lookup(int value) {
			  if(value==0) return  YospaceStatus.PROCESSING_FAILED;
			  YospaceStatus s=(YospaceStatus) _map.get(new Integer(value));
			  if (s==null)return  YospaceStatus.UNKNOWN_STATUS;
			  else return (YospaceStatus) _map.get(new Integer(value));
		  }
			
		/*public static void main(String[] a){
		//	Status s= Status(500);
			System.out.println("name: "+YospaceStatus.lookup(200));
			
		}*/

	}